package com.learning.railwayreservation.biz;

import java.sql.Date;
import java.util.List;

import com.learning.railwayreservation.dao.CheckAvailibilityDao;
import com.learning.railwayreservation.vo.CheckAvailibility2VO;
import com.learning.railwayreservation.vo.CheckAvailibilityVO;

public class CheckAvailibilty {

	public static void main(String args[])
	{
		System.out.println("\nhere is the result\n");
    	System.out.println("\nList of Tickets\n");
    	
    	System.out.println(Date.valueOf("2003-05-03"));
    	
    	CheckAvailibility2VO   availibilityVO = new CheckAvailibility2VO  ();
    	availibilityVO.setTrainNumber(2);
    	availibilityVO.setDateOfJourney(Date.valueOf("2003-05-03"));
    	availibilityVO.setClassType("AC");
    	availibilityVO.setNumberOfTickets(1);
    	
    	
    	doCheckAvailibility(availibilityVO);
    	
    	
    	//doCheckAvailibility(3);
	}
	public static void doCheckAvailibility(int numberOfTickets){
		CheckAvailibilityDao check = new CheckAvailibilityDao();
		List<CheckAvailibilityVO> checkAvailibilityList = check.getResult();
		for (CheckAvailibilityVO checkAvailibilityVO : checkAvailibilityList) {
			System.out.print("\nSeat id: "+ checkAvailibilityVO.getSeatId());
			//System.out.print("  Boggie id: "+ checkAvailibilityVO.getBoggieId());
			System.out.print(", Train name: " + checkAvailibilityVO.getTrainName());
			//System.out.print(", Route Id: " + checkAvailibilityVO.getRouteId());
			//System.out.print("  Vacant Or Reaserved: "+ checkAvailibilityVO.getVacantOrReserved());
			
		}
	}
	
	public static void doCheckAvailibility(CheckAvailibility2VO checkAvailibilityVO){
		CheckAvailibilityDao check = new CheckAvailibilityDao();
		check.getAvailability(checkAvailibilityVO);
	}
	
}
